import request from "@/utils/request";

export function getConRulesList(query){
    return request({
        url:'/contract/rules/list',
        method:'get',
        params:query
    })
}

export function labelProjectTypeByConId(query){

  return request({
    url:'/contract/businessType/label',
    params:query,
  })

}

export function addConRules(data){
    return request({
        url:'/contract/rules/add',
        method:'post',
        data:data
    })
}

export function editConRules(data){
    return request({
        url:'/contract/rules/edit',
        method:'put',
        data:data
    })
}

export function getConRulesById(query){
  return request({
    url:'/contract/rules/getOne/'+query,
  })
}

export function labelProjectFeeByConId(query){
  return request({
    url:'/contract/rules/labelProjectFeeByConId/'+query,
  })
}

export function delRules(query){
  return request({
    url:'/contract/rules/remove/'+query,
    method:'delete'
  })
}

export function listIceConf(query){
  return request({
    url:'/ice-conf/list',
    params:query,
  })
}

//该方法获取 ice id
export function getIceUrl(query){
  return request({
    url:'/contract/rules/getIceUrl/'+query,
  })
}


export function selectConRuleByProjectId(query){
  return request({
    url:'/contract/rules/selectConRuleByProjectId/'+query,
    method:'get'
  })
}


export function getIceConf(id){
  return request({
    url:'/contract/rules/iceConfig/detail/'+id,
  })
}

export function saveIceConf(data){
  return request({
    url:'/contract/ice-conf/save',
    method:'post',
    data:data
  })
}

export function removeIceConf(data){
  return request({
    url:'/contract/ice-conf/remove',
    method:'delete',
    data:data
  })
}

export function exchangeIceConf(data){
  return request({
    url:'/contract/ice-conf/exchange',
    method:'put',
    data:data
  })
}

export function editIceConf(data,query){
  return request({
    url:'/contract/ice-conf/edit',
    method:'put',
    data:data,
    params:query
  })
}

export function releaseIceConf(query){
  return request({
    url:'/contract/ice-conf/release',
    params:query,
    method:'put'
  })
}

export function cleanIceConf(query){
  return request({
    url:'/contract/ice-conf/clean',
    params:query,
    method:'put'
  })
}

export function moveIceConf(data){
  return request({
    url:'/contract/ice-conf/move',
    method:'put',
    data:data
  })
}

/**
 * 根据conId获取该合同下的装卸船计费规则的ruleId，合同下没有装卸船计费规则则返回-1
 * @param data
 * @returns {AxiosPromise}
 */
export function getDiscRuleByConId(data){
  return request({
    url:'/contract/rules/getDiscRuleByConId',
    method:'post',
    data:data
  })
}
